<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<body>
<h1>jianglai BBS</h1><br/>
<a href="/login/index.do">首页</a>
<c:if test="${user != null}">
    ${user.nickName}  <a href="/login/logout.do">登出</a>
</c:if>
<c:if test="${user == null}">
    <a href="/login/loginPage.do">登录</a>&nbsp;
    <a href="/login/registPage.do">注册</a>
</c:if>
    <h2>${category.name}</h2><a href="/post/add/${category.id}">发贴</a>
    <p>
        <c:forEach items="${postList}" var="post" varStatus="index2">
            <a href="/post/${post.id}">${post.title}</a> ${post.nickName} <fmt:formatDate value="${post.createDate}" pattern="yyyy-MM-dd"/><br/>
        </c:forEach>
    </p>
</body>
</html>
